﻿namespace EvaluationSystem.ViewModels;

public class PageInfoVM
{
    /// <summary>
    /// 每页数量
    /// </summary>
    public int PageSize { get; init; } = 10;

    public int CurrentPage { get; set; }

    /// <summary>
    /// 总共数量
    /// </summary>
    public int TotalSize { get; set; }

    /// <summary>
    /// 总共页数
    /// </summary>
    public int TotalPage
    {
        get => getTotalPage();
    }

    private int getTotalPage()
    {
        int page = 1;
        if (TotalSize > 0 && PageSize > 0)
        {
            page = (int) Math.Ceiling((float) TotalSize / (float) PageSize);
        }

        return page;
    }
}